package com.etooling.framework.entity;

import com.etooling.framework.svo.AbstractEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;

/**
 * @author zzr
 * @date 2023/10/23
 * 带缩略图，转换的文件，如于转成预览图用，如pdf要转成图片
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@Table(name = "t_thumb_file", schema = "framework")
public class ThumbFile extends AbstractEntity {
    String sourceFileType;//源文件的类型
    AttachFile sourceAttachFile;
    AttachFile thumbFile;//缩略图
    String fileName;//文件上传时添加描述的文字

    @ManyToOne(targetEntity = AttachFile.class, fetch = FetchType.EAGER)
    @JoinColumn(name = "source_file_id")
    public AttachFile getSourceAttachFile() {
        return sourceAttachFile;
    }

    @ManyToOne(targetEntity = AttachFile.class, fetch = FetchType.EAGER)
    @JoinColumn(name = "thumb_file_id")
    public AttachFile getThumbFile() {
        return thumbFile;
    }
}
